1. Field of the Invention
The present invention generally relates to a video decoding technique, and more particularly, to a reference picture control method conforming to the H.264 compression protocol.
2. Description of Related Art
MPEG video compression format is a commonly used compression format for compressing digital videos, especially for compressing animated data. FIG. 1 is a diagram of a conventional compressed video stream and a bitstream decoding order 100 and a video display order 102 thereof. In the bitstream decoding order 100, the pictures are in the order from 1 to 7, and the pictures have three different encoding patterns I, P, and B. The pictures encoded with the pattern I can be decoded without referring to any other picture. The pictures encoded with the pattern P can be decoded by referring to a previous picture having the encoding pattern I or P to increase the compression ratio. The pictures encoded with the pattern B can be decoded by referring to both a previous picture (forward prediction) and a next picture (backward prediction) in the video display order, and a picture encoded with the pattern B cannot be used for reference by any other picture. The decoded pictures are in the order of 1, 3, 4, 2, 6, 7, and 5 when they are displayed according to the video display order.
Based on foregoing video display order, the reference relationship between the pictures is as shown in FIG. 2. FIG. 2 is a diagram illustrating the storage of reference pictures during a conventional decoding process. During the conventional decoding process, a reference picture is stored in a memory and is only removed when the picture is not needed anymore. Referring to FIG. 2, the arrows indicate the reference relationship between the pictures. For example, the picture I(1) is referred when subsequently the pictures B(3), B(4), and P(2) are decoded.
However, the decoder cannot store all the decoded pictures due to the limited memory space. Accordingly, an efficient memory management is necessary. When a picture is already displayed and will not be used for reference, the memory space taken by this picture should be released for storing another decoded picture.
Table 1 shows the temporary storage states of reference pictures. After the picture I(1) is decoded, because the picture I(1) is temporarily stored since it will be used for reference by subsequent pictures.
After the picture P(2) is decoded, the picture P(2) is also temporarily stored since it will be used for reference by subsequent pictures. Meanwhile, the picture I(1) is still kept in the memory since it is still needed. After the picture B(3) is decoded, because the picture B(3) is not displayed yet, the picture B(3) is kept in the memory. Meanwhile, the pictures I(1) and P(2) are still kept in the memory since they are still needed by subsequent pictures. After the picture B(4) is decoded, the picture I(1) is not needed anymore therefore is removed. At this time, the picture B(4) is kept in the memory since it is not displayed yet. As described above, the reference states of all the pictures can be obtained as:
TABLE 1Decoding stateStorage state#1 completeI(1)#2 completeI(1), P(2)#3 completeI(1), P(2), B(3)#4 completeP(2), B(4)#5 completeP(2), P(5)#6 completeP(2), P(5), B(6)#7 completeP(5), B(7)
It can be understood from foregoing example that in the conventional video coding standard, the memory space can be correctly organized and released as along as whether the currently decoded picture is encoded with the pattern I, P, or B and whether there is any picture encoded with the pattern B in the video display order are determined.
Another broadly used compression technique is the H.264/AVC technique. The H.264/AVC technique is a new generation video coding standard established by a joint video team (JVT) which consists of two video compression standard organizations: the moving picture experts group (MPEG) of ISO/IEC and the video coding experts group (VCEG) of ITU-T. The H.264/AVC technique has become a standard function of digital video/audio products thanks to the powerful compression capability it offers.
However, in the H.264/AVC compression protocol, the encoding patterns I, P, and B are defined differently. In addition, the H/264 standard allows at most 16 reference pictures. Thus, the simple mechanism for organizing and releasing memory space in the MPEG standard is not applicable to the H/264 standard.